<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>jquery动画</title>
    <!-- 
        $(selector).action()

     -->
    <style>
        div {
            position: absolute;
            width: 200px;
            height: 200px;
            background-color: cadetblue;
        }
    </style>
</head>

<body>
    <button class="btn1">隐藏显示</button>
    <button class="btn2">淡入淡出</button>
    <button class="btn3">滑动效果</button>
    <button class="btn4">animation</button>
    <div></div>


    <script src="js/Jquery3.6.js"></script>
    <script>
        $('.btn1').on('click', function () {
            // $('div').css('display','none')
            // $('div').hide(500)
            // $('div').show(1000)
            $('div').toggle(1000)
        })

        $('.btn2').on('click', function () {
            //    $('div').fadeOut(1000)
            //    $('div').fadeIn(1000)
            $('div').fadeToggle(1000)
        })

        $('.btn3').on('click', function () {
            // $('div').slideDown(1000)
            $('div').slideToggle(2000)
        })

        $('.btn4').on('click', function () {
            $('div').animate({ 
                width: 400, 
                height: 400,
                left:100,
                opacity:0.5
            }, 2000)
        })


    </script>
</body>

</html>